package com.gr.staffpm.widget.jqgrid.column;

import java.util.List;

import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.form.IChoiceRenderer;

public class EditableDropDownCellPanel<T extends Object> extends EditableCellPanel {

    private static final long serialVersionUID = 1L;


    public EditableDropDownCellPanel(String id, PropertyColumn<?> column, List<T> values, IChoiceRenderer<T> renderer) {
        super(id);

        DropDownChoice<T> field = new DropDownChoice<T>("dropdown", values, renderer);
        field.setLabel(column.getDisplayModel());
        field.setRequired(true);
        add(field);
    }

    @Override
    @SuppressWarnings("unchecked")
    public FormComponent<T> getEditableComponent() {
        return (FormComponent<T>) get("dropdown");
    }

}
